package com.thinkTank.oa.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkTank.oa.base.BaseServiceImpl;
import com.thinkTank.oa.dao.ProjectOfPersonMapper;
import com.thinkTank.oa.entity.Project;
import com.thinkTank.oa.entity.ProjectOfPerson;
import com.thinkTank.oa.service.ProjectOfPersonService;

@Transactional
@Service("projectOfPersonService")
public class ProjectOfPersonServiceImpl extends BaseServiceImpl<ProjectOfPerson> implements ProjectOfPersonService {
    
    private ProjectOfPersonMapper projectOfPersonMapper;
    
    @Autowired
    public void setProjectOfPersonMapper(ProjectOfPersonMapper projectOfPersonMapper) {
        this.projectOfPersonMapper = projectOfPersonMapper;
        setBaseMapper(projectOfPersonMapper);
    }
    
    @Override
    public List<ProjectOfPerson> queryByProjectId(String projectId) {
        return projectOfPersonMapper.queryByProjectId(projectId);
    }
    
    @Override
    public int deleteByProjectIdAndPersonId(String projectId, String personId) {
        return projectOfPersonMapper.deleteByProjectIdAndPersonId(projectId, personId);
    }
    
    /**
     * 通过项目持有人查询项目
     * @author dongli
     * @date 2018年11月5日
     * @return
     */
    public List<Project> findProjectByProjectHolder(ProjectOfPerson projectOfPerson){
    	return projectOfPersonMapper.findProjectByProjectHolder(projectOfPerson);
    }
}
